<?php 
if ($_POST['k']=="") {
 die("Unable Q:350666582");
}
?>
<!DOCTYPE html>
<meta name="renderer" content="webkit" /> 
<meta http-equiv ="X-UA-Compatible" cotent ="IE=edge,chrome=1"/> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<head>
<title>关键词提取1</title>
</head>
<body>
<?php   
header("Content-Type:text/html; charset=utf8"); 
$hanzi=$_POST['k'];//方便测试GET标题   
$fg=$_POST['fg'];
function dz_segment($title = '', $content = '', $encode = 'utf-8'){   
    if($title == ''){   

        return false;   

    }   

    $title = rawurlencode(strip_tags($title));   

    $content = strip_tags($content);   

    if(strlen($content)>888800){ //在线分词服务有长度限制   

        $content =  mb_substr($content, 0, 8222200, $encode);   

    }   
    $content = rawurlencode($content);   

    $url = 'http://keyword.discuz.com/related_kw.html?title='.$title.'&content='.$content.'&ics='.$encode.'&ocs='.$encode;   

    $xml_array=simplexml_load_file($url);                        //将XML中的数据,读取到数组对象中     

    $result = $xml_array->keyword->result;   

    $data = array();   

    foreach ($result->item as $key => $value) {   

            array_push($data, (string)$value->kw);   

    }   

    if(count($data) > 0){   

        return $data;   

    }else{   

        return false;   

    }   

 }   
$r=dz_segment($hanzi);   
echo "<script type='text/javascript'> 
    function jsCopy(){ 
        var e=document.getElementById('content');//对象是content 
        e.select(); //选择对象 
        document.execCommand('Copy'); //执行浏览器复制命令

       //alert('已复制好，可贴粘。'); 
    } 
</script> 
<textarea cols='600' name='content' rows='2' id='content'>";
foreach($r as $v )
{
    echo "$v$fg";
}
echo "</textarea> 
<input type=button value='复制' onclick='jsCopy();javascript:window.close();'>";
?> 点击复制，可以直接复制并关闭当前页面。
 </body></html>